import 'package:flutter/material.dart';
// import 'package:hixing_app/assets/r_icon.dart';
import 'package:hixing_app/const/color_res.dart';
import 'package:hixing_app/const/gaps.dart';

/// app 字体扩展
extension TextExt on Text {
  Widget getMoreTitle(
      {required void Function() onTap,
      String text = "更多",
      double hPadding = 16.0}) {
    return Row(
      children: [
        Gaps.getHGap(hPadding),
        Expanded(child: this),
        GestureDetector(
          onTap: onTap,
          behavior: HitTestBehavior.opaque,
          child: Row(
            children: [
              Gaps.getHGap(16),
              Text(
                text,
                style: TextStyle(color: Color(0xFFBDC0C6), fontSize: 14),
              ),
              // Container(
              //     width: 24,
              //     height: 24,
              //     child: const Icon(
              //       AppIconR.shouyeGengduo,
              //       color: Color(0xFFBDC0C6),
              //       size: 12,
              //     ))
            ],
          ),
        ),
        Gaps.getHGap(hPadding),
      ],
    );
  }

  Widget getPrice(
      {markSize = 12.0,
      MainAxisAlignment mainAxisAlignment = MainAxisAlignment.center,
      priceSize = 20.0,
      fontWeight = true,
      Color? color}) {
    return Row(
      crossAxisAlignment: CrossAxisAlignment.baseline,
      textBaseline: TextBaseline.alphabetic,
      mainAxisAlignment: mainAxisAlignment,
      children: [
        Text(
          "￥",
          style: TextStyle(
              fontSize: markSize,
              color: color ?? ColorRes.redPrice,
              fontWeight: fontWeight ? FontWeight.bold : FontWeight.normal),
        ),
        Text(
          "$data",
          style: TextStyle(
              fontSize: priceSize,
              color: color ?? ColorRes.redPrice,
              fontWeight: fontWeight ? FontWeight.bold : FontWeight.normal),
        ),
      ],
    );
  }

  Text get getWeight {
    return Text(
      data!,
      style: TextStyle(
          fontWeight: FontWeight.bold,
          color: style?.color,
          fontSize: style?.fontSize),
    );
  }

  Widget getHintText({double fontSize = 12.0}) {
    return Text(
      data!,
      style: TextStyle(color: ColorRes.hintTextColor, fontSize: fontSize),
    );
  }

  Widget getTitle({double fontSize = 16.0, Color? color}) {
    return Text(
      data!,
      style: TextStyle(
          fontWeight: FontWeight.bold, fontSize: fontSize, color: color),
    );
  }

  Widget getLightText({double fontSize = 16.0, double blurRadius = 30}) {
    return Text(
      data!,
      style: TextStyle(
        fontSize: fontSize,
        fontWeight: FontWeight.bold,
        color: ColorRes.hallLight,
        shadows: [
          Shadow(
            blurRadius: blurRadius,
            color: Color(0xFFE87E14),
            offset: Offset(0, 0),
          ),
        ],
      ),
    );
  }

  Widget getLightSubText({double fontSize = 16.0, double blurRadius = 30}) {
    return Text(
      data!,
      style: TextStyle(
        fontSize: fontSize,
        fontWeight: FontWeight.bold,
        color: ColorRes.hallLight,
        shadows: [
          Shadow(
            blurRadius: blurRadius,
            color: Color(0xFFCCAA5E),
            offset: Offset(0, 0),
          ),
        ],
      ),
    );
  }
}
